package ccmis.finance.voucher.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.persistence.NamedNativeQueries;
import javax.persistence.NamedNativeQuery;
import javax.persistence.QueryHint;

import ccmis.finance.voucher.entity.PmvoucherDisassemble;
import jfox.platform.infrastructure.EntityObject;
import jfox.platform.infrastructure.SuperDAO;
@Stateless
@Local
@NamedNativeQueries(
        {
       @NamedNativeQuery(
                name = PmvoucherDisassembleDAOBean.GET_IVVDISA_BY_PZID,
                query = "SELECT * FROM T_FINANCEAL_PMVOUCHER_DISASSEMBLE WHERE  " +
                		"VOUCHER_ID=$VOUCHERE_ID AND DISPART_NO=$DISPARTNO AND  " +
                		"VSTATUS=" + EntityObject.VSTATUS_NORMAL,
               	resultClass = PmvoucherDisassemble.class,
                hints = {
                @QueryHint(name = "cache.partition", value = "function")
                        }
        )
        }
  )
public class PmvoucherDisassembleDAOBean extends SuperDAO implements PmvoucherDisassembleDAO{
	public final static String GET_IVVDISA_BY_PZID = "PmvoucherDisassembleDAOBean.getPmDisassembleByVidDno";
	public List<PmvoucherDisassemble> getPmDisassembleByVidDno(String voucherId,String dispartNo) {
	    Map<String, Object> params = new HashMap<String, Object>(1);
        params.put("VOUCHERE_ID", voucherId.trim());
        params.put("DISPARTNO", dispartNo.trim());
        return (List<PmvoucherDisassemble>)processNamedNativeQuery(PmvoucherDisassembleDAOBean.GET_IVVDISA_BY_PZID,params);
    }
}
